home *** CD-ROM | disk | FTP | other *** search
/ Trading on the Edge / Trading On The Edge - CD-ROM Toolkit (Wayzata Technology)(2031)(1994).bin / mac / Shared / MovingAverage / Documentation.txt next >
Text File  |  1992-11-17  |  2KB  |  78 lines

  1. Statistics`MovingAverage`
  2. =========================
  3.  
  4. Given a list of data, you can calculate means for subsets of the
  5. data.  MovingAverage gives such means repetitively for subsequent
  6. subsets of a determined length.  The first moving average takes
  7. subsets of length 2, the second takes subsets of length 3, and so
  8. forth.  The result of the r moving average is a list of n - r means,
  9. each calculated with r + 1 elements, where n is the length of the
  10. list.
  11.  
  12.  
  13.   MovingAverage[list, r]   give a list of the r^th moving averages          
  14.                                                                               
  15.   MovingAverage[{list_1, list_2, ...}, r]   give the lists of the r^th 
  16.                  moving averages for the columns of the 
  17.                  matrix formed by the given lists 
  18.  
  19.  
  20.                         ^^Moving average functions^^
  21.  
  22.  
  23. This loads the package.
  24.  
  25.      In[1]:= <<Statistics`MovingAverage`
  26.      
  27.  
  28.  
  29. Here is a data set where the data points are represented by symbols.
  30.  
  31.      In[2]:= data = {a, b, c, d, e, f}
  32.  
  33.      Out[2]= {a, b, c, d, e, f}
  34.      
  35.  
  36.  
  37. This is the second moving average.
  38.  
  39.      In[3]:= MovingAverage[data,2]
  40.  
  41.               a + b + c  b + c + d  c + d + e  d + e + f
  42.      Out[3]= {---------, ---------, ---------, ---------}
  43.                   3          3          3          3
  44.      
  45.  
  46.  
  47. You can use a matrix of data as an argument for MovingAverage to
  48. get lists of the r moving averages corresponding to subsets from
  49. each column of data.
  50.  
  51.  
  52.  
  53. This is a new set of data in the form of a matrix.
  54.  
  55.      In[4]:= data = {{a,b,c},{d,e,f},{g,h,i}}
  56.  
  57.      Out[4]= {{a, b, c}, {d, e, f}, {g, h, i}}
  58.      
  59.  
  60.  
  61. Here are the first moving averages.  The first list includes the
  62. means from the first subset for each column.  The second subsets
  63. are averaged in the second list.
  64.  
  65.      In[5]:= MovingAverage[data,1]
  66.  
  67.                a + d  b + e  c + f
  68.      Out[5]= {{-----, -----, -----}, 
  69.                  2      2      2
  70.       
  71.                d + g  e + h  f + i
  72.               {-----, -----, -----}}
  73.                  2      2      2
  74.      
  75.  
  76.  
  77.  
  78.